#ifndef PERSISTENCE_H
#define PERSISTENCE_H
#include <QCoreApplication>
#include <QString>
#include <QHash>
#include <QTimer>
#include <QDir>
#include <QTextStream>
#include "error.h"


#define INVALID_TIME (-100)
#define WRITE_DATA_FAILED   (-101)
#define INVAILD_DBNAME  (-102)

typedef struct Persis_
{
    int TIME = 1000 * 60 * 10;
    QString DBDir = "/data";
    QString DBName;
}Persis;

class Persistence : public QObject
{
    Q_OBJECT
public:
    Persistence();
    int SetTimer(const int time);
    QString GetAppPath();
//    int SaveHashToFile(const QHash<QString,QString> *Hash,const QString DBName);
    int UsageTheDBFile(const QString *DBDir,const QString *DBName);
    void ReadDBFile(const QString *DBDir,const QString *DBName);
public slots:
    int SaveHashToFile(const QHash<QString,QString> *Hash,const QString DBDir,const QString DBName);
};

#endif // PERSISTENCE_H
